<template>
    <div>
        <common-head title="新增联系人"/>
        <van-address-edit
        :area-list="areaList"
        show-postal
        show-set-default
        :area-columns-placeholder="['请选择', '请选择', '请选择']"
        @save="onSave"
        />
    </div>
</template>

<script>
import CommonHead from '@components/CommonHead'
import { areaList } from '@vant/area-data'
import { Toast } from 'vant'

export default {
  methods: {
    onSave (contact) {
      // console.log(contact) 保存输入的内容
      this.$store.commit('contact/add_contact', contact)
      Toast('添加成功')
      // 添加成功后重新回到联系人列表页
      this.$router.replace('/contactLists')
    }
  },
  data () {
    return {
      areaList
    }
  },
  components: {
    CommonHead
  }
}
</script>

<style lang="scss" scoped>
.van-address-edit{
    padding-top: 50px;
}
</style>
